<div class="box inputForm upload">

	<h3>
		<?php echo lang('upload_image') ?>
		<a class="toggleMode" href="<?php echo url_create('site', 'upload', 'video') ?>"><?php echo lang('upload_video') ?> <span class="new">new</span></a>
	</h3>
	<div class="tips">
		<?php echo htmlspecialchars_decode($upload_tip) ?>
	</div>
	<form id="upload_image" method="post" enctype="multipart/form-data" class="submitForm" action="<?php echo url_create('site', 'upload') ?>">            
		<p class="required">
			<label><?php echo lang('select_image') ?></label>
			<input type="file" name="file">
		</p>
		<p class="required">
			<label><?php echo lang('image_title') ?></label>
			<input type="text" value="" name="title" class="text largeWidth">
		</p>
		<?php if($user->upload_text_image){?>
		<p>
			<input type="checkbox" value="1" name="text_image"> <?php echo lang('text_image') ?>
		</p>
		<?php }?>
		<p class="buttonSet">
			<button id="saveButton" type="submit" class="buttons submitButton"><?php echo lang('image_submit') ?></button>
			<a href="/" class="buttons cancelButtons"><?php echo lang('image_cancel') ?></a>
		</p>
		<input type="hidden" name="submit" value="1"/>
	</form>    
</div>
<script>
	$(document).ready(function(){
		var o = <?php echo $json ?>;
		if(typeof(o.message)!='undefined' && o.message!='') {
			$('#mainContainer').prepend('<div class="notification '+o.state+' png_bg">'+
				'<a href="#" class="close"></a>'+
				'<div>'+o.message+'</div>'+
				'</div>')
		}
		if(o.state =='error'){
			for(var i in o.error){
				$('#upload_image [name="'+i+'"]').after(o.error[i]);
				$('#upload_image [name="'+i+'"]').addClass('input-validation-error');
				$('#upload_image [name="'+i+'"]').next().addClass('field-validation-error');
			}
			
		}
			
	});
</script>